//
//  HHLaderPagesCell.m
//  YSJ
//
//  Created by 花花 on 2016/12/15.
//  Copyright © 2016年 花花. All rights reserved.
//

#import "HHLaderPagesCell.h"

@implementation HHLaderPagesCell

#pragma mark - Init Methods
-(instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        [self commonInit];
    }

    return self;

}
-(instancetype)init{
    
    if (self = [super init]) {
        [self commonInit];
    }
    
    return self;
    
}

-(instancetype)initWithCoder:(NSCoder *)aDecoder{
    
    
    if (self = [ super initWithCoder:aDecoder]) {
        [self commonInit];
    }
    
    return self;
}

-(void)awakeFromNib{

    [super awakeFromNib];

      [self commonInit];
}

#pragma mark - layoutSubviews
-(void)layoutSubviews{
  
    [super layoutSubviews];
    
    self.imageView.frame = self.contentView.bounds;
    [self.finishbtn sizeToFit];
    CGFloat finishW = self.finishbtn.bounds.size.width + 2 * margin;
    CGFloat finishH = self.finishbtn.bounds.size.height + 2 * margin;
    CGFloat finishX = (self.bounds.size.width - finishW)/2;
    CGFloat finishY = self.bounds.size.height - finishH - 88;
    
    self.finishbtn.frame = CGRectMake(finishX, finishY, finishW, finishH);

}
#pragma mark - commonInit
-(void)commonInit{

    [self.contentView addSubview:self.imageView];
    
    [self.contentView addSubview:self.finishbtn];
    

}

#pragma mark - Setter && Getter
-(UIButton *)finishbtn{
    
    if (!_finishbtn) {
        _finishbtn =[[UIButton alloc]init];
        _finishbtn.backgroundColor = [UIColor colorWithHexString:ThemeColor];
        _finishbtn.layer.cornerRadius = 10;
        _finishbtn.layer.masksToBounds = YES;
    }

    return _finishbtn;
}

-(UIImageView *)imageView{
    
    if (!_imageView) {
        _imageView =[[UIImageView alloc]init];
        _imageView.contentMode = UIViewContentModeScaleAspectFill;
    }
    
    
    return _imageView;
    
}
@end
